package Task;

/**
 * Created with IntelliJ IDEA.
 * Description: Java多线程实验一代码
 */
class MyThread extends Thread {
    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println(this.getName());
    }
}
public class Test1 {
    public static void main(String[] args) {
        new MyThread("线程一").start();
        new MyThread("线程二").start();
    }

    public static void main1(String[] args) {
        Thread thread1 = new Thread("线程一"){
            @Override
            public void run() {
                System.out.println("线程一");
            }
        };
        Thread thread2 = new Thread("线程二"){
            @Override
            public void run() {
                System.out.println("线程二");
            }
        };
        thread1.start();
        thread2.start();
    }
}
